package com.injection;

//import com.alibaba.druid.pool.DruidDataSource;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

import javax.sql.DataSource;

/**
 * Created by
 *
 * @author touni
 * @date 2019/4/11
 * @time 10:43
 */

/*@Component
@PropertySource("")  //可以引入配置文件classpath:配置文件名.配置文件后缀名   引入后可以用@value注解取值*/
@Configuration
public class DuridInjection {


    /*@Bean
    public DataSource dataSource(){
        DruidDataSource druidDataSource = new DruidDataSource();
        druidDataSource.setUrl("jdbc:mysql://localhost:3306/crm?characterEncoding=utf-8");
        druidDataSource.setDriverClassName("com.mysql.jdbc.Driver");
        druidDataSource.setUsername("root");
        druidDataSource.setPassword("root");
        return druidDataSource;
    }*/


    /*//最快的方式   todo 此处注入有问题

    @Bean
    @ConfigurationProperties(prefix = "jdbc.")   //表示需要使用配置文件中带有jdbc.开头的属性  自动进行注入
    public DataSource dataSource(){
        return new DruidDataSource();
    }
*/
}
